3.3.77 \(\int \cot ^3(c+d x) (a+b \sec (c+d x))^2 \, dx\) [277]

Optimal. Leaf size=92 \[ -\frac {a^2 \log (\cos (c+d x))}{d}-\frac {a (a+b) \log (1-\sec (c+d x))}{2 d}-\frac {a (a-b) \log (1+\sec (c+d x))}{2 d}-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d} \]

[Out]

-a^2*ln(cos(d*x+c))/d-1/2*a*(a+b)*ln(1-sec(d*x+c))/d-1/2*a*(a-b)*ln(1+sec(d*x+c))/d-1/2*cot(d*x+c)^2*(a^2+b^2+
2*a*b*sec(d*x+c))/d

________________________________________________________________________________________

Rubi [A]
time = 0.10, antiderivative size = 92, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3970, 1819, 815} \begin {gather*} -\frac {\cot ^2(c+d x) \left (a^2+2 a b \sec (c+d x)+b^2\right )}{2 d}-\frac {a^2 \log (\cos (c+d x))}{d}-\frac {a (a+b) \log (1-\sec (c+d x))}{2 d}-\frac {a (a-b) \log (\sec (c+d x)+1)}{2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^3*(a + b*Sec[c + d*x])^2,x]

[Out]

-((a^2*Log[Cos[c + d*x]])/d) - (a*(a + b)*Log[1 - Sec[c + d*x]])/(2*d) - (a*(a - b)*Log[1 + Sec[c + d*x]])/(2*
d) - (Cot[c + d*x]^2*(a^2 + b^2 + 2*a*b*Sec[c + d*x]))/(2*d)

Rule 815

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Int[ExpandIntegrand[(
d + e*x)^m*((f + g*x)/(a + c*x^2)), x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[c*d^2 + a*e^2, 0] && Integer
Q[m]

Rule 1819

Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[(c*x)^m*Pq,
 a + b*x^2, x], f = Coeff[PolynomialRemainder[(c*x)^m*Pq, a + b*x^2, x], x, 0], g = Coeff[PolynomialRemainder[
(c*x)^m*Pq, a + b*x^2, x], x, 1]}, Simp[(a*g - b*f*x)*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Dist[1/(2*a*
(p + 1)), Int[(c*x)^m*(a + b*x^2)^(p + 1)*ExpandToSum[(2*a*(p + 1)*Q)/(c*x)^m + (f*(2*p + 3))/(c*x)^m, x], x],
 x]] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x] && LtQ[p, -1] && ILtQ[m, 0]

Rule 3970

Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n_), x_Symbol] :> Dist[-(-1)^((m - 1
)/2)/(d*b^(m - 1)), Subst[Int[(b^2 - x^2)^((m - 1)/2)*((a + x)^n/x), x], x, b*Csc[c + d*x]], x] /; FreeQ[{a, b
, c, d, n}, x] && IntegerQ[(m - 1)/2] && NeQ[a^2 - b^2, 0]

Rubi steps

\begin {align*} \int \cot ^3(c+d x) (a+b \sec (c+d x))^2 \, dx &=\frac {b^4 \text {Subst}\left (\int \frac {(a+x)^2}{x \left (b^2-x^2\right )^2} \, dx,x,b \sec (c+d x)\right )}{d}\\ &=-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d}-\frac {b^2 \text {Subst}\left (\int \frac {-2 a^2-2 a x}{x \left (b^2-x^2\right )} \, dx,x,b \sec (c+d x)\right )}{2 d}\\ &=-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d}-\frac {b^2 \text {Subst}\left (\int \left (-\frac {a (a+b)}{b^2 (b-x)}-\frac {2 a^2}{b^2 x}+\frac {a (a-b)}{b^2 (b+x)}\right ) \, dx,x,b \sec (c+d x)\right )}{2 d}\\ &=-\frac {a^2 \log (\cos (c+d x))}{d}-\frac {a (a+b) \log (1-\sec (c+d x))}{2 d}-\frac {a (a-b) \log (1+\sec (c+d x))}{2 d}-\frac {\cot ^2(c+d x) \left (a^2+b^2+2 a b \sec (c+d x)\right )}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.49, size = 82, normalized size = 0.89 \begin {gather*} -\frac {(a+b)^2 \csc ^2\left (\frac {1}{2} (c+d x)\right )+8 a \left ((a-b) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )+(a+b) \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )+(a-b)^2 \sec ^2\left (\frac {1}{2} (c+d x)\right )}{8 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^3*(a + b*Sec[c + d*x])^2,x]

[Out]

-1/8*((a + b)^2*Csc[(c + d*x)/2]^2 + 8*a*((a - b)*Log[Cos[(c + d*x)/2]] + (a + b)*Log[Sin[(c + d*x)/2]]) + (a
- b)^2*Sec[(c + d*x)/2]^2)/d

________________________________________________________________________________________

Maple [A]
time = 0.12, size = 92, normalized size = 1.00

method result size
derivativedivides \(\frac {-\frac {b^{2}}{2 \sin \left (d x +c \right )^{2}}+2 b a \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )}{d}\) \(92\)
default \(\frac {-\frac {b^{2}}{2 \sin \left (d x +c \right )^{2}}+2 b a \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\left (\cot ^{2}\left (d x +c \right )\right )}{2}-\ln \left (\sin \left (d x +c \right )\right )\right )}{d}\) \(92\)
risch \(i a^{2} x +\frac {2 i a^{2} c}{d}+\frac {2 b a \,{\mathrm e}^{3 i \left (d x +c \right )}+2 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}+2 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+2 b a \,{\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right ) b a}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right ) b a}{d}\) \(165\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^3*(a+b*sec(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(-1/2*b^2/sin(d*x+c)^2+2*b*a*(-1/2/sin(d*x+c)^2*cos(d*x+c)^3-1/2*cos(d*x+c)-1/2*ln(csc(d*x+c)-cot(d*x+c)))
+a^2*(-1/2*cot(d*x+c)^2-ln(sin(d*x+c))))

________________________________________________________________________________________

Maxima [A]
time = 0.27, size = 72, normalized size = 0.78 \begin {gather*} -\frac {{\left (a^{2} - a b\right )} \log \left (\cos \left (d x + c\right ) + 1\right ) + {\left (a^{2} + a b\right )} \log \left (\cos \left (d x + c\right ) - 1\right ) - \frac {2 \, a b \cos \left (d x + c\right ) + a^{2} + b^{2}}{\cos \left (d x + c\right )^{2} - 1}}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^3*(a+b*sec(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/2*((a^2 - a*b)*log(cos(d*x + c) + 1) + (a^2 + a*b)*log(cos(d*x + c) - 1) - (2*a*b*cos(d*x + c) + a^2 + b^2)
/(cos(d*x + c)^2 - 1))/d

________________________________________________________________________________________

Fricas [A]
time = 4.31, size = 113, normalized size = 1.23 \begin {gather*} \frac {2 \, a b \cos \left (d x + c\right ) + a^{2} + b^{2} - {\left ({\left (a^{2} - a b\right )} \cos \left (d x + c\right )^{2} - a^{2} + a b\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - {\left ({\left (a^{2} + a b\right )} \cos \left (d x + c\right )^{2} - a^{2} - a b\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^3*(a+b*sec(d*x+c))^2,x, algorithm="fricas")

[Out]

1/2*(2*a*b*cos(d*x + c) + a^2 + b^2 - ((a^2 - a*b)*cos(d*x + c)^2 - a^2 + a*b)*log(1/2*cos(d*x + c) + 1/2) - (
(a^2 + a*b)*cos(d*x + c)^2 - a^2 - a*b)*log(-1/2*cos(d*x + c) + 1/2))/(d*cos(d*x + c)^2 - d)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sec {\left (c + d x \right )}\right )^{2} \cot ^{3}{\left (c + d x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**3*(a+b*sec(d*x+c))**2,x)

[Out]

Integral((a + b*sec(c + d*x))**2*cot(c + d*x)**3, x)

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 209 vs. \(2 (86) = 172\).
time = 0.52, size = 209, normalized size = 2.27 \begin {gather*} \frac {8 \, a^{2} \log \left ({\left | -\frac {\cos \left (d x + c\right ) - 1}{\cos \left (d x + c\right ) + 1} + 1 \right |}\right ) + \frac {a^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - \frac {2 \, a b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {b^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} - 4 \, {\left (a^{2} + a b\right )} \log \left (\frac {{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right ) + \frac {{\left (a^{2} + 2 \, a b + b^{2} + \frac {4 \, a^{2} {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + \frac {4 \, a b {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}{\cos \left (d x + c\right ) - 1}}{8 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^3*(a+b*sec(d*x+c))^2,x, algorithm="giac")

[Out]

1/8*(8*a^2*log(abs(-(cos(d*x + c) - 1)/(cos(d*x + c) + 1) + 1)) + a^2*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) -
2*a*b*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) + b^2*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) - 4*(a^2 + a*b)*log(ab
s(-cos(d*x + c) + 1)/abs(cos(d*x + c) + 1)) + (a^2 + 2*a*b + b^2 + 4*a^2*(cos(d*x + c) - 1)/(cos(d*x + c) + 1)
 + 4*a*b*(cos(d*x + c) - 1)/(cos(d*x + c) + 1))*(cos(d*x + c) + 1)/(cos(d*x + c) - 1))/d

________________________________________________________________________________________

Mupad [B]
time = 1.36, size = 98, normalized size = 1.07 \begin {gather*} \frac {a^2\,\ln \left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}{d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,{\left (a-b\right )}^2}{8\,d}-\frac {\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (a^2+b\,a\right )}{d}-\frac {{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {a^2}{8}+\frac {a\,b}{4}+\frac {b^2}{8}\right )}{d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)^3*(a + b/cos(c + d*x))^2,x)

[Out]

(a^2*log(tan(c/2 + (d*x)/2)^2 + 1))/d - (tan(c/2 + (d*x)/2)^2*(a - b)^2)/(8*d) - (log(tan(c/2 + (d*x)/2))*(a*b
 + a^2))/d - (cot(c/2 + (d*x)/2)^2*((a*b)/4 + a^2/8 + b^2/8))/d

________________________________________________________________________________________